<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>首页二</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="../css/public.css" media="all">
    <style>
        .layui-card {border:1px solid #f2f2f2;border-radius:5px;}
        .icon {margin-right:10px;color:#1aa094;}
        .icon-cray {color:#ffb800!important;}
        .icon-blue {color:#1e9fff!important;}
        .icon-tip {color:#ff5722!important;}
        .layuimini-qiuck-module {text-align:center;margin-top: 10px}
        .layuimini-qiuck-module a i {display:inline-block;width:100%;height:60px;line-height:60px;text-align:center;border-radius:2px;font-size:30px;background-color:#F8F8F8;color:#333;transition:all .3s;-webkit-transition:all .3s;}
        .layuimini-qiuck-module a cite {position:relative;top:2px;display:block;color:#666;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:14px;}
        .welcome-module {width:100%;height:210px;}
        .panel {background-color:#fff;border:1px solid transparent;border-radius:3px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}
        .panel-body {padding:10px}
        .panel-title {margin-top:0;margin-bottom:0;font-size:12px;color:inherit}
        .label {display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em;margin-top: .3em;}
        .layui-red {color:red}
        .main_btn > p {height:40px;}
        .layui-bg-number {background-color:#F8F8F8;}
        .layuimini-notice:hover {background:#f6f6f6;}
        .layuimini-notice {padding:7px 16px;clear:both;font-size:12px !important;cursor:pointer;position:relative;transition:background 0.2s ease-in-out;}
        .layuimini-notice-title,.layuimini-notice-label {
            padding-right: 70px !important;text-overflow:ellipsis!important;overflow:hidden!important;white-space:nowrap!important;}
        .layuimini-notice-title {line-height:28px;font-size:14px;}
        .layuimini-notice-extra {position:absolute;top:50%;margin-top:-8px;right:16px;display:inline-block;height:16px;color:#999;}
    </style>
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <!-- <div class="layui-card">
            <div class="layui-card-header"><i class="fa fa-warning icon"></i>数据统计</div>
            <div class="layui-card-body">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md3 layui-col-sm3">
                        <div class="col-xs-3 col-md-3">
                            <div class="panel layui-bg-cyan">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <span class="label pull-right layui-bg-blue">总数</span>
                                        <h5>商品统计</h5>
                                    </div>
                                    <div class="panel-content">
                                        <h1 id="book_count_nums" class="no-margins">12</h1>
                                        <div class="stat-percent font-bold text-gray">
                                            <i class="fa fa-commenting"></i> <small>当前分类总记录数</small>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
        
                    <div class="layui-col-md3 layui-col-sm3">
                        <div class="col-xs-3 col-sm-3 col-md-3">
                            <div class="panel layui-bg-blue">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <span class="label pull-right layui-bg-cyan">总数</span>
                                        <h5>订单统计</h5>
                                    </div>
                                    <div class="panel-content">
                                        <h1 id="book_copy_count_nums" class="no-margins">34</h1>
                                        <div class="stat-percent font-bold text-gray"><i class="fa fa-commenting"></i>
                                            <small>当前分类总记录数</small>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 layui-col-sm3">
                        <div class="col-xs-3 col-md-3">
                            <div class="panel" style="background-color:#9198b2;">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <span class="label pull-right" style="background-color: #bcc1ed;">总数</span>
                                        <h5>用户统计</h5>
                                    </div>
                                    <div class="panel-content">
                                        <h1 id="user_count" class="no-margins">11</h1>
                                        <div class="stat-percent font-bold text-gray"><i class="fa fa-commenting"></i>
                                            <small>当前分类总记录数</small>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 layui-col-sm3">
                        <div class="col-xs-3 col-md-3">
                            <div class="panel layui-bg-green">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <span class="label pull-right layui-bg-blue">总数</span>
                                        <h5>风控统计</h5>
                                    </div>
                                    <div class="panel-content">
                                        <h1 id="borrow_count" class="no-margins">12</h1>
                                        <div class="stat-percent font-bold text-gray"><i class="fa fa-commenting"></i>
                                            <small>风控记录数</small>
                                            <small id="borrow_count_history"> 1234 </small>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div> -->
        <div class="layui-card">
            <div class="layui-card-header">
                <i class="fa fa-bullhorn icon icon-tip"></i>未完成的随访记录
                <button id="showall" class="layui-btn layui-btn-sm layui-btn-radius" style="margin-left:20px">查看全部</button>
                <button id="showmy" class="layui-btn layui-btn-sm layui-hide layui-btn-warm layui-btn-radius" style="margin-left:20px">查看我负责的</button>
            </div>
            <div class="layui-card-body">
                <script type="text/html" id="toolbarDemo1">
                    <div class="layui-btn-container"> 
                        <button id="table_tip" class="layui-btn layui-btn-sm layui-btn-primary" >右侧可自定义筛选列</button>
                    </div>
                </script>
                <table class="layui-hide" id="welTable1" lay-filter="welTable1filter"></table>
                <script type="text/html" id="welTable1Bar">
                    <a class="layui-btn data-count-edit layui-btn-xs" data-title="随访档案信息管理" lay-event="tolabel"  layuimini-content-href="page/medicalRecords/index.html">去标注</a>
                </script>
            </div>

            <div class="layui-card">
                <div class="layui-card-header"><i class="fa fa-calendar icon"></i>近15天待随访用户</div>
                <div class="layui-card-body">
                    <script type="text/html" id="current15bar1">
                        <div class="layui-btn-container">
                            <button id="table_tip" class="layui-btn layui-btn-sm layui-btn-primary" >右侧可自定义筛选列</button>
                        </div>
                        </script>
                    <table class="layui-hide" id="current15" lay-filter="current15Filter"></table>
                    <script type="text/html" id="current15Bar">
                        <a class="layui-btn data-count-edit layui-btn-xs" data-title="随访档案信息管理" lay-event="tomr"  layuimini-content-href="page/medicalRecords/index.html">查看</a>
                    </script>
                </div>
            </div>
        </div>
        <a href="javascript:;" layuimini-content-href="page/doctor/index.html" data-title="系统设置" data-icon="fa fa-gears">
            <i class="fa fa-gears"></i>
            <cite>系统设置</cite>
        </a>
        
    </div>
</div>
<script src="../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="../js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script src="../../js/basic-load.js" charset="utf-8"></script>
<script>
    layui.use(['layer', 'miniTab','table'], function () {
        var $ = layui.jquery,
            layer = layui.layer,
            miniTab = layui.miniTab,
            table = layui.table;

        miniTab.listen();

        var docid=sessionStorage.getItem("store_docid")
        if(docid!=null){
                console.log('已登录')
        } 　　
        else{
            //window.location.assign("../login.html");
        }

        table.render({
            elem: '#welTable1',
            url: `${url_basic}/followRecord/timeFollowListDoctor`,
            //url: '../api/table.json',
            where:{  //传医生id
				"doctorId":docid
            },
            method: 'post',
            contentType: 'application/json',
            toolbar: '#toolbarDemo1',
            skin: 'line',
            even: true,
            size: 'lg',
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [[
                {field: 'id', minWidth: 100, title: '随访记录id',align:'center'},
                {field: 'mrId', minWidth: 100, title: '所属档案id',align:'center'},
                {field: 'frCount', minWidth: 110, title: '随访次数', sort: true,align:'center'},
                {field: 'date', minWidth: 180, title: '随访时间',align:'center', sort: true,templet: "<div>{{layui.util.toDateString(d.date, 'yyyy-MM-dd HH:mm:ss')}}</div>"},
                {field: 'type', minWidth: 90, title: '随访类型',align:'center',templet : function(d){
                    if(d.type == 0) return "常规随访"
                    if(d.type == 1) return "不适随访"}},
                {field: 'state', title: '记录状态', minWidth: 90,align:'center',templet : function(d){
                    if(d.state == 1) return "已完成"
                    if(d.state == 2) return "待审核"
                    if(d.state == 3) return "待修改"}},
                {field: 'stateNote', title: '修改建议',align:'center', minWidth: 120},
                {field: 'batteryLife', title: '电池寿命',align:'center', minWidth: 120,hide: true},
                {field: 'lqElectricity', title: '剩余电量',align:'center', minWidth: 120,hide: true},
                {field: 'batteryState', title: '电池状态',align:'center', minWidth: 120,hide: true,templet : function(d){
                    if(d.batteryState == 1) return "OK"
                    if(d.batteryState == 2) return "ERI"}},
                {field: 'maxFrequency', title: '上限跟踪频率',align:'center', minWidth: 150,hide: true},
                {field: 'minFrequency', title: '低限频率',align:'center', minWidth: 150,hide: true},
                {field: 'volts', title: '电压',align:'center', minWidth: 150,hide: true},
                {field: 'comment', title: '患者状态评价',align:'center', minWidth: 120,hide: true,templet : function(d){
                    if(d.batteryState == 0) return "一般"
                    if(d.batteryState == 1) return "很好"
                    if(d.batteryState == 2) return "较差"}},
                {field: 'pacemakerPattern', title: '起搏模式',align:'center', minWidth: 150,hide: true},
                {field: 'performance', title: '随访表现',align:'center', minWidth: 150,hide: true},
                {field: 'suggest', title: '随访建议',align:'center', minWidth: 150,hide: true},
                {title: '操作', minWidth: 133, toolbar: '#welTable1Bar', align: "center"}
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'line'
        });

        table.render({
            elem: '#current15',
            autoSort: true,
            method: 'post',
            url:   `${url_basic}/medicalRecords/timeMedicalList`,
            //url: '../api/table.json',
            contentType: 'application/json',
            toolbar: '#current15bar1',
            skin: 'line',
            even: true,
            size: 'lg',
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [[               
                { field: 'id', minWidth: 50, title: '患者Id', sort: true },  
                { field: 'realName', minWidth: 120, title: '患者姓名', sort: true },
                { field: 'phoneNum', minWidth: 120, title: '患者手机号', sort: true },
                { field: 'pacemakerName', minWidth: 120, title: '起搏器名称', sort: true },
                { field:'pacemakerDepend',minWidth: 50, title: '是否起搏器依赖',sort: true,templet : function (d){
		            if(d.pacemakerDepend == 2){
		                return '否';
		            }else if(d.pacemakerDepend == 1){
		                return '是';		    	  
			        }}
                },
                { field: 'nextTime', minWidth: 200, title: '下次随访时间', sort: true,
                    templet: "<div>{{layui.util.toDateString(d.nextTime, 'yyyy-MM-dd HH:mm:ss')}}</div>"
                }, 
                { field: 'followCounts', minWidth: 50, title: '已随访次数', sort: true },
                {fixed: 'right',title: '操作', minWidth: 133, toolbar: '#current15Bar', align: "center"}
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 15,
            page: true,
            skin: 'line'
        });
        

        $("#showall").click(function(){
            $("#showall").addClass("layui-hide")
            $("#showmy").removeClass("layui-hide")
            table.reload('welTable1', {
                url: `${url_basic}/followRecord/timeFollowListAll`,
                //url: '../api/table.json',
                where: { },
                cols: [[
                    {field: 'doctorName', minWidth: 100, title: '记录医生',align:'center'},
                    {field: 'id', minWidth: 100, title: '随访记录id',align:'center',hide: true},
                    {field: 'mrId', minWidth: 100, title: '所属档案id',align:'center'},
                    {field: 'frCount', minWidth: 110, title: '随访次数', sort: true,align:'center'},
                    {field: 'date', minWidth: 180, title: '随访时间',align:'center', sort: true,templet: "<div>{{layui.util.toDateString(d.date, 'yyyy-MM-dd HH:mm:ss')}}</div>"},
                    {field: 'type', minWidth: 90, title: '随访类型',align:'center',templet : function(d){
                        if(d.type == 0) return "常规随访"
                        if(d.type == 1) return "不适随访"}},
                    {field: 'state', title: '记录状态', minWidth: 90,align:'center',templet : function(d){
                        if(d.state == 1) return "已完成"
                        if(d.state == 2) return "待审核"
                        if(d.state == 3) return "待修改"}},
                    {field: 'stateNote', title: '修改建议',align:'center', minWidth: 120},
                    {field: 'batteryLife', title: '电池寿命',align:'center', minWidth: 120,hide: true},
                    {field: 'batteryState', title: '电池状态',align:'center', minWidth: 120,hide: true,templet : function(d){
                        if(d.batteryState == 1) return "OK"
                        if(d.batteryState == 2) return "ERI"}},
                    {field: 'maxFrequency', title: '上限跟踪频率',align:'center', minWidth: 150,hide: true},
                    {field: 'minFrequency', title: '低限频率',align:'center', minWidth: 150,hide: true},
                    {field: 'pacemakerPattern', title: '起搏模式',align:'center', minWidth: 150,hide: true},
                    {field: 'performance', title: '随访表现',align:'center', minWidth: 150,hide: true},
                    {field: 'suggest', title: '随访建议',align:'center', minWidth: 150,hide: true},
                    {title: '操作', minWidth: 133, toolbar: '#welTable1Bar', align: "center"}
            ]],
            });
        });

        $("#showmy").click(function(){
            $("#showall").removeClass("layui-hide")
            $("#showmy").addClass("layui-hide")
            table.reload('welTable1', {
                url: `${url_basic}/followRecord/timeFollowListDoctor`,
                //url: '../api/table.json',
                where: {"doctorId":docid},
                cols: [[
                    {field: 'id', minWidth: 100, title: '随访记录id',align:'center'},
                    {field: 'mrId', minWidth: 100, title: '所属档案id',align:'center'},
                    {field: 'frCount', minWidth: 110, title: '随访次数', sort: true,align:'center'},
                    {field: 'date', minWidth: 180, title: '随访时间',align:'center', sort: true,templet: "<div>{{layui.util.toDateString(d.date, 'yyyy-MM-dd HH:mm:ss')}}</div>"},
                    {field: 'type', minWidth: 90, title: '随访类型',align:'center',templet : function(d){
                        if(d.type == 0) return "常规随访"
                        if(d.type == 1) return "不适随访"}},
                    {field: 'state', title: '记录状态', minWidth: 90,align:'center',templet : function(d){
                        if(d.state == 1) return "已完成"
                        if(d.state == 2) return "待审核"
                        if(d.state == 3) return "待修改"}},
                    {field: 'stateNote', title: '修改建议',align:'center', minWidth: 120},
                    {field: 'batteryLife', title: '电池寿命',align:'center', minWidth: 120,hide: true},
                    {field: 'batteryState', title: '电池状态',align:'center', minWidth: 120,hide: true,templet : function(d){
                        if(d.batteryState == 1) return "OK"
                        if(d.batteryState == 2) return "ERI"}},
                    {field: 'maxFrequency', title: '上限跟踪频率',align:'center', minWidth: 150,hide: true},
                    {field: 'minFrequency', title: '低限频率',align:'center', minWidth: 150,hide: true},
                    {field: 'pacemakerPattern', title: '起搏模式',align:'center', minWidth: 150,hide: true},
                    {field: 'performance', title: '随访表现',align:'center', minWidth: 150,hide: true},
                    {field: 'suggest', title: '随访建议',align:'center', minWidth: 150,hide: true},
                    {title: '操作', minWidth: 133, toolbar: '#welTable1Bar', align: "center"}
            ]],
            });
        });
        
        table.on('tool(welTable1filter)', function (obj) {
            var data = obj.data;
            if (obj.event === 'tolabel') {
                sessionStorage.setItem("labelfrommain",1);
                sessionStorage.setItem("mrId1",data.mrId);
                //sessionStorage.setItem("mrId1",15);
            } 
        });

        table.on('tool(current15Filter)', function (obj) {
            var data = obj.data;
            if (obj.event === 'tomr') {
                // console.log('aaaa')
                sessionStorage.setItem("mrfrommain",1);
                sessionStorage.setItem("mrId2",data.id);//这个条目里好像没有
                //sessionStorage.setItem("mrId2",15);
            } 
        });
    });
</script>
</body>
</html>
